
clear all
set more off
cap log close

ssc install unique
    
global dir "/Replication Archive"
cd "${dir}"

global outreg_settings = " label bdec(4) pvalue pdec(3) tex(frag) excel  nor2 nonotes "



************************************
************* TABLE A1 *************
************************************

use "${dir}/Data/Final Datasets/Final_Data_Director_MC_Level_DEF2.dta", clear


gen asin_amount=ln(amount_noself+sqrt(1+amount_noself^2))

unique CompanyID
local unique_company: display %5.4fc `r(unique)' 

collapse (max) asin_amount amount_noself relevant, by(DirectorID cycle icpsr2 chamber)

egen double Director_MC=group(DirectorID icpsr2 chamber)
egen double Congress_MC=group(icpsr2 chamber cycle)
egen double Congress_Director=group(DirectorID cycle chamber)

unique DirectorID 
local unique_directors: display %5.4fc `r(unique)' 
unique icpsr2 
local unique_MC: display %5.4fc `r(unique)' 

reghdfe asin_amount relevant, noabsorb cluster(Director_MC) keepsingletons
su asin_amount if relevant ==0 & e(sample)==1, d
local mean: display %5.4fc `r(mean)' 
local effect = _b[relevant]/`mean'*100
local effect: display %5.4fc `effect'
outreg2 using "${dir}/Results/TableA1", $outreg_settings addtext(Mean, `mean', Increase, `effect', Num. Individuals, `unique_directors', Num. Companies, `unique_company', Num. MCs, `unique_MC', Individual-MC FE, No, MC-Cycle FE, No, Individual-Cycle FE, No)  nocons

reghdfe asin_amount relevant, absorb(Director_MC) cluster(Director_MC) keepsingletons
su asin_amount if relevant ==0 & e(sample)==1, d
local mean: display %5.4fc `r(mean)' 
local effect = _b[relevant]/`mean'*100
local effect: display %5.4fc `effect'
outreg2 using "${dir}/Results/TableA1", $outreg_settings addtext(Mean, `mean', Increase, `effect', Num. Individuals, `unique_directors', Num. Companies, `unique_company', Num. MCs, `unique_MC', Individual-MC FE, No, MC-Cycle FE, No, Individual-Cycle FE, No)  nocons

reghdfe asin_amount relevant, absorb(Director_MC Congress_MC) cluster(Director_MC) keepsingletons
su asin_amount if relevant ==0 & e(sample)==1, d
local mean: display %5.4fc `r(mean)' 
local effect = _b[relevant]/`mean'*100
local effect: display %5.4fc `effect'
outreg2 using "${dir}/Results/TableA1", $outreg_settings addtext(Mean, `mean', Increase, `effect', Num. Individuals, `unique_directors', Num. Companies, `unique_company', Num. MCs, `unique_MC', Individual-MC FE, No, MC-Cycle FE, No, Individual-Cycle FE, No)  nocons

reghdfe asin_amount relevant, absorb(Director_MC Congress_MC Congress_Director) cluster(Director_MC) keepsingletons
su asin_amount if relevant ==0 & e(sample)==1, d
local mean: display %5.4fc `r(mean)' 
local effect = _b[relevant]/`mean'*100
local effect: display %5.4fc `effect'
outreg2 using "${dir}/Results/TableA1", $outreg_settings addtext(Mean, `mean', Increase, `effect', Num. Individuals, `unique_directors', Num. Companies, `unique_company', Num. MCs, `unique_MC', Individual-MC FE, No, MC-Cycle FE, No, Individual-Cycle FE, No)  nocons
